create table if not exists jms_dm.dm_waybill_taking_hour_summary_dt(
    taking_date                 date         comment '揽收日期'
    ,network_code               varchar(255) comment '揽件网点CODE'
    ,network_name               varchar(255) comment '揽件网点名称'
    ,network_fran_code          varchar(255) comment '揽件加盟商CODE'
    ,network_fran_name          varchar(255) comment '揽件加盟商名称'
    ,network_agent_code         varchar(255) comment '揽件代理区CODE'
    ,network_agent_name         varchar(255) comment '揽件代理区名称'
    ,center_code                varchar(255) comment '交件转运中心CODE'
    ,center_name                varchar(255) comment '交件转运中心名称'
    ,zone_code                  varchar(255) comment '片区CODE'
    ,zone_name                  varchar(255) comment '片区名称'
    ,area_code                  varchar(255) comment '底层片区CODE'
    ,area_name                  varchar(255) comment '底层片区名称'
    ,taking_qty                 bigint       comment '揽收量'
    ,interrupted_taking_qty     bigint       comment '截单后揽收量'
    ,hour_segment1_taking_qty   bigint       comment '时间段1揽收量(15点之前)'
    ,hour_segment2_taking_qty   bigint       comment '时间段2揽收量(15-16点)'
    ,hour_segment3_taking_qty   bigint       comment '时间段2揽收量(16-17点)'
    ,hour_segment4_taking_qty   bigint       comment '时间段3揽收量(17-18点)'
    ,hour_segment5_taking_qty   bigint       comment '时间段4揽收量(18-19点)'
    ,hour_segment6_taking_qty   bigint       comment '时间段5揽收量(19-20点)'
    ,hour_segment7_taking_qty   bigint       comment '时间段6揽收量(20-21点)'
    ,hour_segment8_taking_qty   bigint       comment '时间段7揽收量(21-24点)'
) ENGINE=OLAP
DUPLICATE KEY(
    taking_date , network_code, network_name
)
COMMENT "经营指标-订单揽收时间段汇总"
PARTITION BY RANGE(`taking_date`)(
START ('2023-07-01') END ('2023-07-30') EVERY (INTERVAL 1 day)
)
DISTRIBUTED BY HASH(network_code, network_name) BUCKETS 5
PROPERTIES (
    "replication_num" = "3",
    "dynamic_partition.enable" = "true",
    "dynamic_partition.time_unit" = "DAY",
    "dynamic_partition.time_zone" = "Asia/Shanghai",
    "dynamic_partition.start" = "-93",
    "dynamic_partition.end" = "3",
    "dynamic_partition.prefix" = "p",
    "dynamic_partition.buckets" = "5",
    "in_memory" = "false",
    "storage_format" = "V2"
);
